package com.smartHire.service.impl;

import com.smartHire.dao.ShopDao;
import com.smartHire.domain.Shop;
import com.smartHire.domain.User;
import com.smartHire.service.ShopService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.jsp.tagext.TryCatchFinally;
import java.util.List;




@Service("shopService")
public class ShopServiceImpl implements ShopService{
    @Resource(name = "shopDao")
    private ShopDao shopDao;

    public void setShopDao(ShopDao shopDao) {
        this.shopDao = shopDao;
    }


    @Override
    public int addShop(Shop shop) {

        try {
            int nums = shopDao.inserShop(shop);
            return nums;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return 0;
    }
    @Override
    public List<Shop> queryshop() {
        try {
            List<Shop> shops = shopDao.selectShop();
            return shops;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public Shop queryShopById(Shop shop) {
        try {
            Shop shop1= shopDao.selectShopByID(shop);
            return shop1;
        }catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Shop queryShopByName(Shop shop) {
        try {
            Shop shop1= shopDao.selectShopByName(shop);
            return shop1;
        }catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Shop> searchShop(Shop shop) {
        try {
            List<Shop> shops = shopDao.searchShop(shop);
            return shops;

        }catch (Exception e)
        {
            e.printStackTrace();
        }

        return null;
    }

}
